package com.huxi.lang.object;

public final class VIndex implements CharSequence {

	public final String path;
	public final String key;
	public final int index;

	private VIndex(String path, String key, int index) {
		this.path = path;
		this.key = key;
		this.index = index;
	}

	@Override
	public int hashCode() {
		return path.hashCode();
	}

	@Override
	public boolean equals(Object other) {
		if (other == this) {
			return true;
		}
		if (other instanceof VIndex) {
			return path.equals(((VIndex) other).path);
		}
		return false;
	}

	@Override
	public String toString() {
		return path;
	}

	@Override
	public int length() {
		return path.length();
	}

	@Override
	public char charAt(int index) {
		return path.charAt(index);
	}

	@Override
	public CharSequence subSequence(int start, int end) {
		return path.subSequence(start, end);
	}
}
